Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Scala Native #118

Merged
merged 10 commits into from
Jul 31, 2017
Merged

Support for Scala Native #118

merged 10 commits into from
Jul 31, 2017

Conversation

alonsodomin
Copy link

This is an initial stab at adding support for Scala Native. Some observations on this:

  • Scala Native does not support 2.12 yet, so the 2.11 version is forced
  • Scala Native does not support weak hashmaps, so the PositionCache has been implemented the same way as it was in ScalaJS (no cache).

@xuwei-k
Copy link
Contributor

xuwei-k commented Jul 10, 2017

Any updates?

@alonsodomin
Copy link
Author

The main stopper here is the fact that the build in Travis is required to pass in OpenJDK 6. Scala Native requires JDK 7+ since the compiler plugin uses the NIO file system API. So if the maintainers do not want to drop JDK 6 support, then this PR goes nowhere.

Besides, there is still some work pending even dropping support for JDK 6. Mainly run the scala native build only on Scala 2.11.x and avoid the tests. I would like to have some feedback from the maintainers though on whether this is a piece of work they would be interested on having or not.

Copy link
Contributor

@gourlaysama gourlaysama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @alonsodomin! I would definitely be interested in getting this merged. Having scala-native support would be awesome!

See my other comment on how to make Travis happy. Not the cleanest, but it works. There are also some merge conflicts to fix, but I'll be happy to merge this afterwards.

build.sbt Outdated
@@ -43,6 +44,10 @@ lazy val `scala-parser-combinators` = crossProject.in(file(".")).
jsSettings(
name := "scala-parser-combinators-js"
).
nativeSettings(
name := "scala-parser-combinators-native",
scalaVersion := "2.11.11"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this should fix the whole Travis issue:

-    scalaVersion := "2.11.11"
+   skip in compile := !scalaVersion.value.startsWith("2.11") || System.getProperty("java.version").startsWith("1.6"),
+   test := {}

@lrytz
Copy link
Member

lrytz commented Jul 17, 2017

@alonsodomin @gourlaysama if you can think of anything in https://github.com/scala/sbt-scala-module that would make this easier and apply to other modules, there's no problem in releasing a new version there.

@alonsodomin
Copy link
Author

@gourlaysama @lrytz got it passing in the end, had to remove all org.scala-native artifacts when the Scala version was not 2.11 since, for some reason, was trying to download the compiler plugin.

A bit hacky but it seems to work. Maybe worth adding these settings to sbt-scala-module using a scalaModuleSettingsNative so they can be reused...:

scalaVersion := "2.11.11",
skip in compile := System.getProperty("java.version").startsWith("1.6"),
test := {},
libraryDependencies := {
  if (!scalaVersion.value.startsWith("2.11"))
    libraryDependencies.value.filterNot(_.organization == "org.scala-native")
  else libraryDependencies.value
}

@gourlaysama
Copy link
Contributor

gourlaysama commented Jul 28, 2017

@alonsodomin could you rebase, #120 introduced some conflicts? I'll merge this and release 1.0.7 soon after that :)

@alonsodomin alonsodomin changed the title WIP: Support for Scala Native Support for Scala Native Jul 30, 2017
@gourlaysama gourlaysama merged commit fd760fc into scala:1.0.x Jul 31, 2017
gourlaysama added a commit to gourlaysama/scala-parser-combinators that referenced this pull request Jan 31, 2018
This reverts commit fd760fc, reversing
changes made to 615b70f.

 Conflicts:
	build.sbt
	project/plugins.sbt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants